package com.web.cms.pan.dao;

import com.blue.jdbc.BaseDao;
import com.web.cms.pan.model.UserInfo;
import org.springframework.stereotype.Repository;

/**
 * 用户网盘信息数据库访问
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2018年04月09日
 */
@Repository("panUserInfoDao")
public class UserInfoDao extends BaseDao<UserInfo>
{
	public UserInfoDao()
	{
	}
	
	@Override
	protected void query(StringBuilder sql, UserInfo param)
	{
		if (param != null)
		{
			if (param.getPoint() != null)
				sql.append(" and a.point=:point");
				
			if (param.getFiles() != null)
				sql.append(" and a.files=:files");
				
			if (param.getDeleteFiles() != null)
				sql.append(" and a.delete_files=:deleteFiles");
				
		}
		sql.append(" order by a.id desc");
	}

	public void add(Integer id)
	{
		if (this.count("id", id) > 0)
			return;

		this.saveObject("id", id);
	}
	
}
